package cn.saltybe.analysis.crawler.wbtc.secondHandHouse;

import com.geccocrawler.gecco.annotation.*;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.SpiderBean;

import java.util.List;

@Gecco(
        matchUrl = { "https://{}.58.com/ershoufang/", "https://{}.58.com/ershoufang/p{page}/" },
        pipelines = { "wbtcSecondHandHouseListPipeline" },
        downloader = "htmlUnitDownloader")
public class WbtcSecondHandHouseList implements SpiderBean {
    @Request
    private HttpRequest request;

    public HttpRequest getRequest() {
        return request;
    }

    public void setRequest(HttpRequest request) {
        this.request = request;
    }

    @Href(click = false)
    @HtmlField(cssPath = "#__layout > div > section > section.list-main > section.list-left > section:nth-child(3) > div > a")
    private List<String> houseList;

    @Text
    @HtmlField(cssPath = "#__layout > div > section > section.list-main > section.list-left > section.pagination-wrap > div > ul > li.page-item.active > a")
    private String currentPage;

    @Href(click = false)
    @HtmlField(cssPath = "#__layout > div > section > section.list-main > section.list-left > section.pagination-wrap > div > a.next.next-active")
    private String nextPageUrl;

    public String getNextPageUrl() {
        return nextPageUrl;
    }

    public void setNextPageUrl(String nextPageUrl) {
        this.nextPageUrl = nextPageUrl;
    }

    public String getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(String currentPage) {
        this.currentPage = currentPage;
    }

    public List<String> getHouseList() {
        return houseList;
    }

    public void setHouseList(List<String> houseList) {
        this.houseList = houseList;
    }
}
